package com.fengmi.controller;

import com.fengmi.dto.SearchDTO;
import com.fengmi.entity.ESGoods;
import com.fengmi.service.ISearchService;
import com.fengmi.vo.PageResultVo;
import com.fengmi.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("search")
public class SearchController {

    @Autowired
    private ISearchService searchService;

    @RequestMapping("init")
    public ResultVO init(){

        return  searchService.init();
    }

    @RequestMapping("goods")
    public PageResultVo<ESGoods> search(@RequestBody SearchDTO searchDTO){
        return  searchService.search(searchDTO);
    }


    @RequestMapping("suggest")
    public ResultVO suggest(String tip){

        return  searchService.suggest(tip);
    }
}
